<template>
    <f7-page>
        <f7-navbar title="个人主页" back-link="返回">
            <f7-nav-right>
                <f7-link>设置</f7-link><f7-link>分享</f7-link>
            </f7-nav-right>
        </f7-navbar>


            <div class="bg-personpage">
                <div class="text-align-center">
                    <div v-if="goodsBsInfo.company">
                        <h4 class="text-black gap-20">
                         {{goodsBsInfo.company.nick_name}}
                        </h4>
                        <h4 class="gap-10"><img src='../../assets/img/label-v.png' class="label-v"></h4>
                    </div>
                      <img  class="companyhome-icon gap-20" src="../../assets/img/infor-face.png">
                        <h3 class="text-black" v-if="goodsBsInfo.user">
                         {{goodsBsInfo.user.real_name}}
                        </h3>
                         <h4 class="text-gray gap-5 line-height" v-if="goodsBsInfo.arrBuy">
                                <span>采购:</span>
                                <span class="distance" v-for="item in goodsBsInfo.arrBuy">{{item.chn}}</span>
                        </h4>
                        <h4 class="text-gray gap-5 line-height" v-if="goodsBsInfo.arrSell">
                                <span>销售:</span>
                                <span v-for="item in goodsBsInfo.arrSell" class="distance">{{item.chn}} </span>
                        </h4>
                         <p class="gap-20 text-gray">备注</p>
                </div>
                <div class="bg-companynpage">
                <div class="row row-homepage text-align-center text-gray gap-20" >
                        <div class="col text-orange">
                            <h4>报价</h4>
                            <h4 class="gap-5 ng-binding">{{goodsNubInfo.SALE_DJ}}</h4>
                        </div>

                        <div class="col text-orange">
                            <h4>竞价</h4>
                            <h4 class="gap-5 ng-binding">{{goodsNubInfo.SALE_JJ}}</h4>
                        </div>
                          <div class="col text-orange">
                            <h4>采购</h4>
                            <h4 class="gap-5 ng-binding">{{goodsNubInfo.PURCHASE}}</h4>
                        </div>

                        <div class="col text-orange">
                            <h4>运输</h4>
                            <h4 class="gap-5 ng-binding">{{goodsNubInfo.TRAFFIC}}</h4>
                        </div>
                    </div>
                </div>
       </div>


          <f7-block class="text-align-center">
                                <span class="order-title">2018年07月04日</span>
            </f7-block>



     <f7-card class="enterprise_card" v-for="item in goodsListInfo">
            <f7-card-header>
               <img src="../../assets/img/infor-face.png"  class="logo-ion">
                <div class="text-center_article"> {{item.user.real_name}}</div>
                <div class="text-center_weight"></div>
                <div class="text-right">
                    <span>{{item.company.nick_name}}</span>
                     <img sv-if="params.verify_phase=='SUCCESS'" src="../../assets/img/label-v.png" class="label-v">
                </div>
            </f7-card-header>

          <f7-block>
                <f7-col>
                    <div v-if="item.list">
                        <div class="row-wrap">
                            <p class="classification" v-for="item1 in item.list.product_categories" v-if="item1.layer">
                               <img  src='../../assets/img/label-goodsicon.png' class="label-icon-trade">
                                 {{item1.layer.layer_1_chn}}
                            </p>
                            <div v-for="item1,index in item.list.price_history">
                                    <div class="item-add" v-for="item2 in item.list.product_categories">
                                        <h6>{{item1.name}}</h6>
                                        <div v-for="item3,val in item2.product_name" v-if="index==val">
                                            <span v-for="item4 in item3.attribute">
                                                {{item4.name}}:{{item4.value}}{{item4.unit}}
                                            </span>
                                        </div>
                                    </div>
                                    <div class="item-fot text-orange">
                                        <span v-for="item2 in item1.price_weight">过磅价：￥{{item2.price}}</span>
                                        <span v-for="item2 in item1.price_remember">理记价：￥{{item2.price}}</span>
                                    </div>
                           </div>
                        </div>
                    </div>
                </f7-col>
            </f7-block>
        </f7-card>





    <f7-toolbar>
            <div class="row button-foot">
                <div class="col col-50 col-light">打电话</div>
                <div class="col col-50 col-light col-green" @click="sendMsg()">发信息</div>
            </div>
    </f7-toolbar>






        <!-- <div v-for="item in goodsListInfo">
            <div>
                <span v-if="item.user">
                    <span>头像</span>
                    <h4>{{item.user.real_name}}</h4>
                </span>
                <span v-if="item.company">
                    <h4>{{item.company.nick_name}}</h4>
                    <span v-if="item.company.verify_phase=='SUCCESS'">认证</span>
                </span>
            </div>
            <div v-if="item.list">
                <div v-for="item1 in item.list.product_categories" v-if="item1.layer">
                    {{item1.layer.layer_1_chn}}
                </div>
                <div v-for="item1 in item.list.price_history">
                    <div v-for="item2 in item.list.product_categories">
                        <hr/>
                        <p>{{item1.name}}</p>
                        <div v-for="item3 in item2.product_name">
                            <p v-for="item4 in item3.attribute" >
                                {{item4.name}}:{{item4.value}}{{item4.unit}}
                            </p>
                        </div>
                    </div>
                    <div>
                        <span v-for="item2 in item1.price_weight">过磅价：￥{{item2.price}}</span>
                        <span v-for="item2 in item1.price_remember">理记价：￥{{item2.price}}</span>
                    </div>
                </div>
            </div>
            <hr/>
        </div>   -->


    </f7-page>
</template>

<script>
    import F7Page from "framework7-vue/src/components/page";
    export default {
        name: "relationGsDtl",
        components: {F7Page},
        data(){
            return{
                goodsListInfo:'',
                goodsBsInfo:'',
                goodsNubInfo:''
            }
        },
        methods:{
            async goodsListDtls () {
                let param = {user_id: this.routerParams.goodsid,page:1,type:"trade_pricing"}
                this.goodsListInfo = (await this.OtherService.getBsList(param)).data.data.list
            },
            async goodsBsDtls () {
                let param = {user_id: this.routerParams.goodsid}
                this.goodsBsInfo = (await this.AccountService.getPersonalPage(param)).data.data
            },
            async goodsNubDtls () {
                let param = {user_id: this.routerParams.goodsid,page:1,type:"trade_pricing"}
                this.goodsNubInfo = (await this.OtherService.getGoodsDtl(param)).data.data
            },
            sendMsg(){
                let param = {
                    userId: this.routerParams.goodsid,
                    userRole: this.goodsBsInfo.user.role,
                    role: this.Storage.get('user').user.role
                }


                console.log(param)
                window.cordova.plugins.yimPlugin.chat(param.userId, 0, param.role, param.userRole, '0xA2A2F0', function (success) {
                    console.log('云信Chat成功', success)
                }, function () {
                    console.log('云信Chat失败')
                })
            }
        },
        created(){
            this.goodsListDtls()
            this.goodsBsDtls()
            this.goodsNubDtls()
        }
    }
</script>

<style scoped>
.button-foot {
    width: 100%;
    position: relative;
    font-size: 14px;
    line-height: 42px;
}
.button-foot .col-light {
    background: #fff;
    color: #999;
    border-left: 1px solid #f5f5f5;
    font-size: 14px;
    text-align: center;
    width: 50% !important;
}
.button-foot .col-green {
    color: #fff;
    background: #68b54b;
}




.ios .page {
    background: #f5f5f5;
  }
.gap-20 {
    margin-top: 20px;
}
.gap-10 {
    margin-top: 10px;
}
.gap-5{
    margin-top: 5px;
}
.companyhome-icon {
    border: 2px solid #fff;
    border-radius: 100%;
    width: 100px;
    height: 100px;
    box-sizing: border-box;
}
.text-gray {
    color: #999;
    font-size: 12px;
}
.distance{
    margin: 0px 4px;
}
.label-v {
  width: 24px;
  height: 14px;
  vertical-align: text-bottom;
  vertical-align: middle;
}
.order-title {
    padding: 2px 10px;
    border-radius: 5px;
    display: inline-block;
    font-size: 11px;
    color: #666;
}






.enterprise_card {
  padding: 5px 0 5px 0 !important;
}
.ios .card-footer,
.card-header {
  position: initial;
}
.logo-ion {
  position: absolute;
  top: 8px;
  left: 12px;
  width: 40px;
  height: 40px;
  border-radius: 100%;
}
.text-center_article {
  position: absolute;
  font-size: 14px;
  color: #333;
  padding-left: 50px;
  top: 20px;
}
.text-center_weight {
  font-size: 12px;
  position: absolute;
  padding-left: 50px;
  color: #999;
  top: 40px;
}
.text-right {
  position: absolute;
  text-align: center;
  right: 20px;
  top: 10px;
}
.text-right span {
  margin: 0 0 3px 0;
  font-size: 10px;
  color: #666;
  display: inherit;
}
.label-v {
  width: 24px;
  height: 14px;
  vertical-align: text-bottom;
  vertical-align: middle;
  background: #f0f0f0;
}

.row-wrap {
  padding: 10px 0px;
}
.item-add {
  background: #f8fff0;
  padding: 4px 10px;
  margin: 10px 0px;
  border-left: 1px solid green;
}

.item-add h6 {
  width: 100%;
  color: rgb(51, 140, 37);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: bold;
  display: inline-block;
}

.text-orange {
  color: #ff6c00;
}
.item-fot,
.item_address {
  margin-top: 5px;
}
.item-add span {
  margin: 0px 5px;
  font-size: 12px;
  color:  rgb(51, 140, 37);
}

.item-fot {
  font-size: 12px;
}
.item-fot span{
 margin: 0 5px;
}
.classification {
  height: 21px;
  color: #333;
  font-size: 14px;
  margin: 0px;
  margin-top: 10px;
}
.label-icon-trade {
  width: 32px;
  height: 16px;
  margin-right: 18px;
  margin-top: 2px;
  float: left;
}
</style>
